// eslint-disable-next-line
import { UserLayout, BasicLayout, PageView } from '@/perm/layouts'
import { productCode } from './productModule'

const RouteView = {
  name: 'RouteView',
  render: (h) => h('router-view')
}

// 每个路由必须有meta
// sticky 表示第二个菜单栏是否固定
const asyncRouterMap = [
  {
    path: '/',
    name: 'perm-index',
    component: BasicLayout,
    redirect: '/dashboard',
    children: [
      {
        path: '/dashboard',
        name: 'perm-dashboard',
        redirect: '/dashboard/workplace',
        component: PageView,
        hideChildrenInMenu: true,
        meta: { title: '必火首页', keepAlive: true, icon: 'home', sticky: false, permission: ['dashboard'] },
        children: [
          {
            path: '/dashboard/workplace',
            name: 'per-dashboard-workplace',
            component: () => import('@/perm/views/dashboard/home-lbsq'),
            meta: { title: '必火首页', keepAlive: true, permission: ['dashboard'] }
          }
        ]
      },
      {
        path: '/lbsq',
        component: PageView,
        name: '公众号',
        redirect: '/lbsq/gzh',
        meta: { title: '公众号', icon: 'dashboard' },
        children: [
          {
            path: '/lbsq/gzh',
            name: 'gzh',
            hideChildrenInMenu: false,
            component: PageView,
            redirect: '/lbsq/gzh/index',
            meta: { title: '授权管理', keepAlive: true, permission: ['user'] },
            productPermission: [],
            children: [
              {
                path: '/lbsq/gzh/index',
                name: 'gzh-index',
                component: () => import('@/perm/views/mp/gzhQywx'),
                meta: {
                  title: '授权管理',
                  keepAlive: true,
                  productPermission: [productCode.WxWorkBasic, productCode.WxWorkVIP]
                }
              },
              {
                path: '/lbsq/gzh/fsgl',
                name: 'fsgl-index',
                component: () => import('@/perm/views/mp/fsgl-list'),
                meta: {
                  title: '粉丝管理',
                  keepAlive: true,
                  productPermission: [productCode.WxWorkBasic, productCode.WxWorkVIP]
                }

              }
            ]
          },
          {
            path: '/lbsq/rwb',
            name: '任务宝',
            component: PageView,
            redirect: '/lbsq/rwb/index',
            meta: { title: '任务宝', keepAlive: true, permission: ['user'] },
            children: [
              {
                path: '/lbsq/rwb/index',
                name: '活动管理',
                component: () => import('@/perm/views/ren-wu-bao/hdgl-list'),
                meta: {
                  title: '活动管理',
                  keepAlive: true,
                  productPermission: [productCode.WxWorkBasic, productCode.WxWorkVIP]
                }

              },
              {
                path: '/lbsq/rwb/edit',
                name: 'edit-index',
                hidden: true,
                component: () => import('@/perm/views/ren-wu-bao/edit/hdgl-edit'),
                meta: {
                  title: '活动编辑',
                  keepAlive: true,
                  productPermission: [productCode.WxWorkBasic, productCode.WxWorkVIP]
                }
              },
              {
                path: '/lbsq/rwb/sjtj',
                name: '/lbsq/rwb/sjtj',
                component: () => import('@/perm/views/ren-wu-bao/sjtj-list'),
                meta: {
                  title: '数据统计',
                  keepAlive: true,
                  productPermission: [productCode.WxWorkBasic, productCode.WxWorkVIP]
                }
              },
              {
                path: '/lbsq/rwb/cyfs',
                name: 'cyfs-index',
                hidden: true,
                component: () => import('@/perm/views/ren-wu-bao/cyfs'),
                meta: {
                  title: '参与粉丝',
                  keepAlive: true,
                  productPermission: [productCode.WxWorkBasic, productCode.WxWorkVIP]
                }
              },
                {
                    path: '/lbsq/rwb/qdgl',
                    name: '/lbsq/rwb/qdgl',
                    hidden: true,
                    component: () => import('@/perm/views/ren-wu-bao/channelManage'),
                    meta: {
                        title: '渠道管理',
                        keepAlive: true,
                        productPermission: [productCode.WxWorkBasic, productCode.WxWorkVIP]
                    }
                }
            ]
          }
        ]
      },
      {
        path: '/qywx',
        component: RouteView,
        name: '企业微信',
        redirect: '/qywx/gkzl',
        meta: { title: '企业微信', icon: 'photo_filter', keepAlive: true, permission: ['user'] },

        children: [
          {
            path: '/qywx/gkzl',
            name: 'gkzl',
            hideChildrenInMenu: false,
            component: PageView,
            redirect: '/qywx/gkzl/index',
            meta: { title: '概况总览', keepAlive: true, permission: ['user'] },
            productPermission: [],
            children: [
              {
                path: '/qywx/gkzl/index',
                name: 'gkzl-index',
                component: () => import('@/perm/views/qywx/gkzl'),
                meta: {
                  title: '概况总览',
                  keepAlive: true,
                  productPermission: [productCode.WxWorkBasic, productCode.WxWorkVIP]
                }

              }
            ]
          },
          {
            path: '/qywx/jcgn',
            name: 'qywx-jcgn',
            component: PageView,
            redirect: '/qywx/jcgn/bind',
            meta: { title: '基础功能', keepAlive: true, permission: ['user'] },
            children: [
              {
                path: '/qywx/jcgn/bind',
                name: '/qywx/jcgn/bind',
                component: () => import('@/perm/views/qywx/bindQywx'),
                meta: {
                  title: '企业微信',
                  keepAlive: true,
                  productPermission: [productCode.WxWorkBasic, productCode.WxWorkVIP]
                }

              },
              {
                path: '/qywx/jcgn/member',
                name: '/qywx/jcgn/member',
                component: () => import('@/perm/views/qywx/memberQywx'),
                meta: {
                  title: '成员管理',
                  keepAlive: true,
                  productPermission: [productCode.WxWorkBasic, productCode.WxWorkVIP]
                }
              },
              {
                path: '/qywx/jcgn/gzh',
                name: '/qywx/jcgn/gzh',
                component: () => import('@/perm/views/mp/gzhQywx'),
                meta: {
                  title: '公众号',
                  keepAlive: true,
                  productPermission: [productCode.WxWorkBasic, productCode.WxWorkVIP]
                }
              }
            ]
          },
          {
            path: '/qywx/lbhk',
            name: '/qywx/lbhk',
            redirect: '/qywx/lbhk/rwlb',
            component: PageView,
            meta: { title: '裂变获客', keepAlive: true, permission: ['user'] },
            children: [
              {
                path: '/qywx/lbhk/xjrwlb',
                name: '/qywx/lbhk/xjrwlb',
                component: () => import('@/perm/views/qywx/hdgl/HdglEdit'),
                meta: {
                  title: '新建任务',
                  keepAlive: true,
                  productPermission: [productCode.WxWorkBasic, productCode.WxWorkVIP]
                }
              },
                {
                    path: '/qywx/lbhk/xjhylb',
                    name: '/qywx/lbhk/xjhylb',
                    component: () => import('@/perm/views/qywx/hyhd/HdglEdit'),
                    meta: {
                        title: '新建好友',
                        keepAlive: true,
                        productPermission: [productCode.WxWorkBasic, productCode.WxWorkVIP]
                    }
                },
              {
                path: '/qywx/lbhk/rwlb',
                name: '/qywx/lbhk/rwlb',
                component: () => import('@/perm/views/qywx/hdgl/HdglList'),
                meta: {
                  title: '任务裂变',
                  keepAlive: true,
                  productPermission: [productCode.WxWorkBasic, productCode.WxWorkVIP]
                }

              },
                {
                    path: '/qywx/lbhk/hylb',
                    name: '/qywx/lbhk/hylb',
                    component: () => import('@/perm/views/qywx/hyhd/HdglList'),
                    meta: {
                        title: '好友裂变',
                        keepAlive: true,
                        productPermission: [productCode.WxWorkBasic, productCode.WxWorkVIP]
                    }

                },
              {
                path: '/qywx/lbhk/qwqdgl',
                name: '/qywx/lbhk/qwqdgl',
                hidden: true,
                component: () => import('@/perm/views/qywx/hdgl/channelManage'),
                meta: {
                  title: '渠道管理',
                  keepAlive: true,
                  productPermission: [productCode.WxWorkBasic, productCode.WxWorkVIP]
                }
              },
                {
                    path: '/qywx/lbhk/hyqdgl',
                    name: '/qywx/lbhk/hyqdgl',
                    hidden: true,
                    component: () => import('@/perm/views/qywx/hyhd/channelManage'),
                    meta: {
                        title: '渠道管理',
                        keepAlive: true,
                        productPermission: [productCode.WxWorkBasic, productCode.WxWorkVIP]
                    }
                }
            ]
          },
          {
            path: '/qywx/khgl',
            name: '/qywx/khgl',
            redirect: '/qywx/khgl/page',
            component: PageView,
            meta: { title: '客户管理', keepAlive: true },
            children: [
              {
                path: '/qywx/khgl/page',
                name: '/qywx/khgl/page',
                component: () => import('@/perm/views/qywx/khgl/KhglPage'),
                meta: { title: '客户信息', keepAlive: true, productPermission: [productCode.WxWorkBasic, productCode.WxWorkVIP] }
              },
                {
                    path: '/qywx/khgl/detail',
                    name: '/qywx/khgl/detail',
                    hidden: true,
                    component: () => import('@/perm/views/qywx/khgl/KhglH5'),
                    meta: { title: '客户信息', keepAlive: true, productPermission: [productCode.WxWorkBasic, productCode.WxWorkVIP] }
                },
              {
                path: '/qywx/bqgl',
                name: 'bqgl',
                component: () => import('@/perm/views/qywx/tag/tagManage'),
                meta: { title: '标签管理', keepAlive: true, productPermission: [productCode.WxWorkBasic, productCode.WxWorkVIP] }
              },
                {
                    path: '/qywx/khqgl',
                    name: 'bqgl',
                    component: () => import('@/perm/views/qywx/group/groupPage'),
                    meta: { title: '客户群管理', keepAlive: true, productPermission: [productCode.WxWorkBasic, productCode.WxWorkVIP] }
                },
                {
                    path: '/qywx/khqsop',
                    name: 'bqgl',
                    component: () => import('@/perm/views/qywx/sop/sopPage'),
                    meta: { title: '客户群SOP', keepAlive: true, productPermission: [productCode.WxWorkBasic, productCode.WxWorkVIP] }
                }
            ]
          },
          {
            path: '/qywx/hdsj',
            name: '/qywx/hdsj',
            redirect: '/qywx/hdsj/index',
            component: PageView,
            meta: { title: '数据分析', keepAlive: true },
            children: [
              {
                path: '/qywx/hdsj/index',
                name: '/qywx/hdsj/index',
                component: () => import('@/perm/views/qywx/sjtj/GameDataTotal/index'),
                meta: { title: '活动数据', keepAlive: true, productPermission: [productCode.WxWorkVIP] }
              }
            ]
          },
          {
            path: '/qywx/sjfx',
            name: '/qywx/sjfx',
            redirect: '/qywx/sjfx/page',
            component: PageView,
            hidden: true,
            meta: { title: '数据分析', keepAlive: true },
            children: [
              {
                path: '/qywx/sjfx/page',
                name: '/qywx/sjfx/page',
                component: () => import('@/perm/views/qywx/sjtj/GameData'),
                meta: {
                  title: '数据统计',
                  keepAlive: true,
                  productPermission: [productCode.WxWorkBasic, productCode.WxWorkVIP]
                }

              }
            ]
          },
          {
            path: '/qywx/fwwd',
            name: '/qywx/fwwd',
            redirect: '/qywx/fwwd/cpsc',
            component: PageView,
            meta: { title: '服务文档', keepAlive: true, permission: ['user'] },
            children: [
              {
                path: '/qywx/fwwd/cpsc',
                name: '/qywx/fwwd/cpsc',
                component: () => import('@/perm/views/fwwd/cpsc.vue'),
                meta: { title: '操作手册', keepAlive: true, permission: ['user'] }
              },
              {
                path: '/qywx/fwwd/bbgx',
                name: '/qywx/fwwd/bbgx',
                component: () => import('@/perm/views/fwwd/bbgx.vue'),
                meta: { title: '版本更新', keepAlive: true, permission: ['user'] }
              }
            ]
          }
        ]

      },

      // list
      // {
      //   path: '/bhhb/list',
      //   name: 'list',
      //   component: PageView,
      //   redirect: '/list/basic-list',
      //   meta: { title: '必火海报', icon: 'wallpaper', permission: ['table'] },
      //   children: [
      //     {
      //       path: '/bhhb/basic-list',
      //       name: 'BasicList',
      //       hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
      //       component: () => import('@/views/list/BasicList'),
      //       meta: { title: '标准列表', keepAlive: true, permission: ['table'] }
      //     }
      //   ]
      // },
      {
        path: '/product',
        name: 'product',
        component: RouteView,
        redirect: '/product/list',
        meta: { title: '订购产品', icon: 'local_atm', permission: ['profile'] },
        children: [
          {
            path: '/product/list',
            name: '/product/list',
            hideChildrenInMenu: true,
            component: PageView,
            redirect: '/product/list/index',
            meta: { title: '产品列表', keepAlive: true, permission: ['profile'] },
            children: [
              {
                path: '/product/list/index',
                name: '/product/list/index',
                component: () => import('@/perm/views/product/product-list.vue'),
                meta: { title: '产品列表', keepAlive: true, permission: ['user'] }
              }
            ]
          },
          {
            path: '/product/my',
            name: '/product/my',
            hideChildrenInMenu: true,
            redirect: '/product/my/index',
            component: PageView,
            meta: { title: '我的服务', permission: ['profile'] },
            children: [
              {
                path: '/product/my/index',
                name: '/product/my/index',
                component: () => import('@/perm/views/product/my-product-list'),
                meta: { title: '我的服务', keepAlive: true, permission: ['user'] }
              }
            ]
          },
          {
            path: '/product/order',
            name: '/product/order',
            hideChildrenInMenu: true,
            component: PageView,
            redirect: '/product/order/index',
            meta: { title: '订购记录', permission: ['profile'] },
            children: [
              {
                path: '/product/order/index',
                name: '/product/order/index',
                component: () => import('@/perm/views/product/product-order'),
                meta: { title: '订购记录', keepAlive: true, permission: ['user'] }
              }
            ]
          }
        ]
      },

      {
        path: '/lbzl',
        name: '/lbzl',
        redirect: '/lbzl/lbgh/index',
        component: RouteView,
        meta: { icon: 'web', title: '裂变资料', keepAlive: true, permission: ['user'] },
        children: [
          {
            path: '/lbzl/lbgh',
            name: '/lbzl/lbgh',
            hideChildrenInMenu: true,
            redirect: '/lbzl/lbgh/index',
            component: PageView,
            meta: { title: '裂变干货', keepAlive: true, permission: ['user'] },
            children: [
              {
                path: '/lbzl/lbgh/index',
                name: '/lbzl/lbgh/index',
                component: () => import('@/perm/views/lbzl/lbgh.vue'),
                meta: { title: '裂变干货', keepAlive: true, permission: ['user'] }
              }
            ]
          },
          {
            path: '/lbzl/lbhb',
            name: '/lbzl/lbhb',
            hideChildrenInMenu: true,
            redirect: '/lbzl/lbhb/index',
            component: PageView,
            meta: { title: '裂变海报', keepAlive: true, permission: ['user'] },
            children: [
              {
                path: '/lbzl/lbhb/index',
                name: '/lbzl/lbhb/index',
                component: () => import('@/perm/views/lbzl/lbhb.vue'),
                meta: { title: '裂变海报', keepAlive: true, permission: ['user'] }
              }
            ]
          }
        ]
      },
        {
            path: '/tzgj',
            name: '/tzgj',
            redirect: '/tzgj/qrcode',
            component: RouteView,
            meta: { icon: 'wallpaper', title: '团长工具', keepAlive: true, permission: ['user'] },
            children: [
                {
                    path: '/tzgj/qrcode',
                    name: '/tzgj/qrcode',
                    hideChildrenInMenu: true,
                    redirect: '/tzgj/qrcode/bhhb',
                    component: PageView,
                    meta: { title: '团长工具', keepAlive: true, permission: ['user'] },
                    children: [
                        {
                            path: '/tzgj/qrcode/bhhb',
                            name: '/tzgj/qrcode/bhhb',
                            component: () => import('@/perm/views/tzgj/index.vue'),
                            meta: { title: '必火海报', keepAlive: true, permission: ['user'] }
                        },
                        {
                            path: '/tzgj/qrcode/bhjl',
                            name: '/tzgj/qrcode/bhjl',
                            component: () => import('@/perm/views/tzgj/index.vue'),
                            meta: { title: '必火接龙', keepAlive: true, permission: ['user'] }
                        }, {
                            path: '/tzgj/qrcode/qld',
                            name: '/tzgj/qrcode/qld',
                            component: () => import('@/perm/views/tzgj/index.vue'),
                            meta: { title: '亲来单', keepAlive: true, permission: ['user'] }
                        }
                    ]
                }
            ]
        },
      {
        path: '/fwwd',
        name: '/fwwd',
        redirect: '/fwwd/cpsc',
        component: RouteView,
        meta: { icon: 'add_to_queue', title: '服务文档', keepAlive: true, permission: ['user'] },
        children: [
          {
            path: '/fwwd/cpsc',
            name: '/fwwd/cpsc',
            hideChildrenInMenu: true,
            redirect: '/fwwd/cpsc/index',
            component: PageView,
            meta: { title: '操作手册', keepAlive: true, permission: ['user'] },
            children: [
              {
                path: '/fwwd/cpsc/index',
                name: '/fwwd/cpsc/index',
                component: () => import('@/perm/views/fwwd/cpsc.vue'),
                meta: { title: '操作手册', keepAlive: true, permission: ['user'] }
              }
            ]
          },
          {
            path: '/fwwd/bbgx',
            name: '/fwwd/bbgx',
            hideChildrenInMenu: true,
            redirect: '/fwwd/cpsc/index',
            component: PageView,
            meta: { title: '版本更新', keepAlive: true, permission: ['user'] },
            children: [
              {
                path: '/fwwd/bbgx/index',
                name: '/fwwd/bbgx/index',

                component: () => import('@/perm/views/fwwd/bbgx.vue'),
                meta: { title: '版本更新', keepAlive: true, permission: ['user'] }
              }
            ]
          }
        ]
      },
      {
        path: '/gywo',
        name: 'perm-gywo',
        redirect: '/gywo/index',
        component: PageView,
        hideChildrenInMenu: true,
        meta: { title: '关于我们', keepAlive: true, icon: 'home', sticky: false, permission: ['dashboard'] },
        children: [
          {
            path: '/gywo/index',
            name: '/gywo/index',
            component: () => import('@/perm/views/dashboard/gywm'),
            meta: { title: '关于我们', keepAlive: true, permission: ['dashboard'] }
          }
        ]
      }
    ]
  }
]

const constantRouterMap = [
  {
    path: '/user',
    name: 'user',
    component: UserLayout,
    redirect: '/user/login',
    children: [
      {
        path: '/user/login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/perm/views/user/Login')
      }
    ]
  }
]

export default {
  asyncRouterMap,
  constantRouterMap
}
